package com.cy.config;

import com.cy.interceptor.TimeInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 写一个配置类：
 * 对拦截器进行设置
 */
@Configuration
public class SpringWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TimeInterceptor())//添加一个拦截器
        .addPathPatterns("/consumer/*");//拦截哪一个？--拦截以consumer开头的
    }
}
